Skip to main content

Authentication & API Setup

To interact with DrChrono’s API, Bookadoc uses OAuth 2.0, a secure authorization protocol that enables safe access to DrChrono’s services. This authentication ensures that only authorized systems can retrieve and modify appointment data, patient records, and provider schedules.

DrChrono requires API clients to use Client Credentials Grant Flow, which involves obtaining an authorization code and access token before making API requests.


OAuth 2.0 Authentication Process

The authentication process follows these steps:

Authorization

Proceed directly to the Authorization tab of the DrChrono Postman Collection from the collection overview screen. On the Authorization tab choose "OAUTH 2.0" from the "Auth Type" dropdown box. Use the table provided below to complete the configure token section:

ParameterDescription
Token NameDrChronoToken
Grant typeAuthorization Code
Callback URLhttps://www.bookadoc.com
Auth URLhttps://drchrono.com/o/authorize/
Access Token URLhttps://drchrono.com/o/token/
Client IDUnique identifier for Bookadoc’s integration
Client SecretSecret key for authentication
Scopelabs:read labs:write messages:read messages:write patients:read patients:write patients:summary:read patients:summary:write settings:read settings:write tasks:read tasks:write user:read user:write billing:patient-payment:read billing:patient-payment:write billing:read billing:write calendar:read calendar:write clinical:read clinical:write
StateLeave as is
Client AuthenticationLeave as is

Once everything is filled, select the orange button at the bottom of the page - "Get New Access Token".


Error Handling in Authentication

If authentication fails, the API returns an error response. Bookadoc must handle these scenarios properly.

Common Authentication Errors

Error CodeDescriptionResolution
401 UnauthorizedInvalid credentials or expired tokenEnsure correct credentials and refresh token if expired
403 ForbiddenInsufficient permissionsVerify API scope and permissions
500 Internal Server ErrorAthenaHealth service issueRetry after some time

Security Best Practices

To ensure secure authentication:

  • Store API credentials securely using environment variables.
  • Rotate client credentials periodically to reduce security risks.
  • Use HTTPS for all API requests to encrypt sensitive data.

Conclusion

Bookadoc authenticates with DrChrono using OAuth 2.0, obtaining an access token to make secure API requests. The integration ensures smooth authentication handling, token renewal, and error management, allowing seamless access to appointment and patient data.


(https://alethian.postman.co/workspace/Alethian-Workspace~f5e907d1-ba56-4ea0-8007-4186bca19dcb/collection/40825772-a2d68d0c-0afa-4faf-a8a8-8e5ef4b73b12?action=share&creator=40825772)